
<?php
class intro{
	private $id;
	private $title;
	private $description;
	private $link;
	private $img_small;
	private $img;
	private $date;
	private $order;
	private $location;

	
	// set get id
	public function setid($id) {
		$this->id = $id;
	}
	public function getid() {
		return $this->id;
	}
	// set get title
	public function settitle($title) {
		$this->title = $title;
	}
	public function gettitle() {
		return $this->title;
	}
	// set get descriptioon
	public function setdescription($description) {
		$this->description = $description;
	}
	public function getdescription() {
		return $this->description;
	}
	// set get link
	public function setlink($link) {
		$this->link = $link;
	}
	public function getlink() {
		return $this->link;
	}
// set get order
	public function setorder($val) {
		$this->order = $val;
	}
	public function getorder() {
		return $this->order;
	}
	// set get img small
	public function setimg_small($img_small) {
		$this->img_small = $img_small;
	}
	public function getimg_small() {
		return $this->img_small;
	}
	// set get img
	public function setimg($img) {
		$this->img = $img;
	}
	public function getimg() {
		return $this->img;
	}
	// 	set get date
	public function setdate($date) {
		$this->date = $date;
	}
	public function getdate() {
		return $this->date;
	}
	// 	set get date
	public function setlocation($location) {
		$this->location = $location;
	}
	public function getlocation() {
		return $this->location;
	}
	public function listbylocal() {
		GLOBAL $db;
		if ($this->location) $where = " where location='".$this->getlocation()."'";
		$sql = "SELECT * FROM " . $db->tbl_fix . "intro".$where;		
		$result = $db->executeQuery ( $sql );
		while ( $rows = mysql_fetch_array ( $result ) ) {
			$return [] = $rows;
		}
		return $return;
	}
	public function getone() {
		GLOBAL $db;
		$sql = "SELECT * FROM " . $db->tbl_fix . "intro where id='" . $this->getid() . "'";
		$return = $db->executeQuery ( $sql, 2 );
		return $return;
	}
	public function update(){
		GLOBAL $db;
		$arr['title'] = $this->gettitle();
		$arr['description'] = $this->getdescription();
		if ($this->img) $arr['img'] = $this->getimg();
		$arr['link'] = $this->getlink();
		$arr['order'] = $this->getorder();
		$db->record_update($db->tbl_fix."intro", $arr,"`id`='".$this->getid()."'");
	}
	// ======= get wiget home
	public function wget_home(){
		global $db;
		$sql = "select * from ".$db->tbl_fix."intro where location = '".$this->getlocation()."' order by `order`";
		$result = $db->executeQuery ( $sql );
		while ( $rows = mysql_fetch_array ( $result ) ) {
			$return [] = $rows;
		}
		return $return;
	}
	
}
$intro = new intro ();
?>